<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>订单支付</title>
<script type="text/javascript">
var order_sn = "{$res['id']}";
//调用微信JS api 支付
function jsApiCall(){
	WeixinJSBridge.invoke(
		'getBrandWCPayRequest',
		<?php echo $jsApiParameters; ?>,
		function(res){
			//如果支付成功
			if (res.err_msg == 'get_brand_wcpay_request:ok') {
				//支付成功后跳转的地址
				location.href = "http://www.nleaves.com/qinqin/wechat/user/czcg.html?money={$money}";
			}else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
				alert('充值取消');
				location.href = "http://www.nleaves.com/qinqin/wechat/user/rechar.html";
			}else if (res.err_msg == 'get_brand_wcpay_request:fail') {
				alert('支付失败');
				location.href = "http://www.nleaves.com/qinqin/wechat/user/rechar.html";
			}else {
				alert(res.err_msg);
			}
			//WeixinJSBridge.log(res.err_msg);
			//alert(res.err_code+res.err_desc+res.err_msg);
			/*if (res.err_msg == 'get_brand_wcpay_request:ok') {
				alert('支付成功');
			}else {
				alert('取消支付');
			}*/
		}
	);
}
window.onload=function(){
	if (typeof WeixinJSBridge == "undefined"){
	    if( document.addEventListener ){
	        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
	    }else if (document.attachEvent){
	        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
	        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
	    }
	}else{
	    jsApiCall();
	}
}

</script>
</head>
<body>
<!--头部开始-->

<!--尾结束-->
</body>
</html>